TARGET = XNLTest

XNLTest_ROOT = ..
XNL_ROOT = ../../XNL
THIS_LIB_DIR = $(XNLTest_ROOT)/lib

INCLUDES += \

SOURCES = \
$(XNLTest_ROOT)/main.cpp

# define parameter
CCFLAGS += -Wno-sequence-point
CXXFLAGS += -Wno-sequence-point -std=c++0x

OBJ_DIR = obj

include $(XNL_ROOT)/proj.linux/xnl.mk

$(shell cp -r $(LIB_DIR)/* $(THIS_LIB_DIR))

SHAREDLIBS += -L$(LIB_DIR) -lxnl

LIBS = -L../lib -lxnl

TARGET_DIR = $(XNLTest_ROOT)/bin/linux
TARGET := $(TARGET_DIR)/$(TARGET)

all: $(TARGET)

run: $(TARGET)
	cd $(dir $^) && ./$(notdir $^)

.PHONY: all run

$(TARGET): $(OBJECTS) $(CORE_MAKEFILE_LIST)
	@mkdir -p $(@D)
	$(LOG_LINK)
	$(CXX) -Wl,--rpath $(THIS_LIB_DIR) $(CXXFLAGS) $(OBJECTS) -o $@ $(SHAREDLIBS) $(STATICLIBS) $(LIBS)

$(OBJ_DIR)/%.o: %.cpp $(CORE_MAKEFILE_LIST)
	@mkdir -p $(@D)
	$(LOG_CXX)$(CXX) $(CXXFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@

$(OBJ_DIR)/%.o: %.c $(CORE_MAKEFILE_LIST)
	@mkdir -p $(@D)
	$(LOG_CC)$(CC) $(CCFLAGS) $(INCLUDES) $(DEFINES) -c $< -o $@
